package com.event.ingestion.data.hbase;

import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;

public class TrainParser extends com.event.ingestion.data.TrainParser<Put> {
    @Override
    public Put parse(String[] fields) {
        Put p = new Put(Bytes.toBytes((fields[0] + "." + fields[1]).hashCode()));  //rowkey

        p = p.addColumn(Bytes.toBytes("eu"),Bytes.toBytes("user"),Bytes.toBytes(fields[0]));
        p = p.addColumn(Bytes.toBytes("eu"),Bytes.toBytes("event"),Bytes.toBytes(fields[1]));
        p = p.addColumn(Bytes.toBytes("eu"),Bytes.toBytes("invited"),Bytes.toBytes(fields[2]));
        p = p.addColumn(Bytes.toBytes("eu"),Bytes.toBytes("timestamp"),Bytes.toBytes(fields[3]));
        p = p.addColumn(Bytes.toBytes("eu"),Bytes.toBytes("interested"),Bytes.toBytes(fields[4]));
        p = p.addColumn(Bytes.toBytes("eu"),Bytes.toBytes("not_interested"),Bytes.toBytes(fields[5]));

        return p;
    }
}
